var app = getApp();
let api = require("../../utils/api.js")
Page({
  data: {
    list: [{
      id: 1,
      name: '芒果',
      content: "我是张三，见到大家很高兴。。。",
      img:"https://cclove.club/xcx/ok.jpg"
    }, {
      id: 2,
      name: '香蕉',
      content: "我是李四，可以带大将去玩。。。。",
      img:"https://cclove.club/xcx/ok.jpg"

    },{
        id: 3,
        name: '苹果',
        content: "我是王五，我编码贼好。。。。",
        img:"https://cclove.club/xcx/ok.jpg"
      }]
  },

  click: function (e) { 
    // console.log("按了：", e.currentTarget.id)
    var ProjectDetailId = e.currentTarget.id;
    var ProjectDetailtype = "indexuser";
    wx.navigateTo({
      url: '/pages/projectdetail/projectdetail?id=' + ProjectDetailId+'&type='+ProjectDetailtype,
    })
  },

  onLoad(options){
    let token = wx.getStorageSync('token')    //从同步本地缓存中获取token
    // 获取数据
    wx.request({
      url: api.myPush,
      header: {'Authorization':'JWT'+' '+token},
      dataType: "json",
      method: "GET",
      success: (result) => {
       //  console.log(result.data.data,'>>>>>')
        this.setData({
          list:result.data.data
        })
        // console.log(result.data.data,'>>>>>')
      },
    })
  },
  
})
